var goodsInfo = {};


var week = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];

$(() => {
	goodsInfo = getAllGoods()[0];
	handleBanner(goodsInfo.images);
	console.log(goodsInfo)

	// let test = 1.335;
	// console.log(test.toFixed(2))
	// console.log(roundToFixed2(test,2))

	// let arr = [1,4,7,2,3,4,6]
	// console.log(sum(...arr))

	// let res = getParameters("https://www.google.com.hk/search?q=js+md&newwindow=1");
	// console.log(res)

	// console.log(copyText({id:'123',text:'24354654646'}))

	// console.log(getSelectedText())
	// console.log(phoneReg.test('11168353215'))

	// const htmlStr = '<div style="background:#000;"><span style="color:#fff"></span></div>'

	// console.log(colorReg.exec(htmlStr))

	// let newObj = Object.assign({}, arr);
	// console.log(copyObj({id:'123',text:'24354654646'}))

	// let strssss = 'sfafasfsdgfdgwefdg';
	// console.log(strssss.substring(0,5))
	// console.log(strssss.substr(0,5))

	// const obj1 = { a: 1, b: 2 };
	// const obj2 = { b: 1, c: 2,a:3 };
	// console.log(mergedObj(obj1,obj2));
	// //console.log(mergedObj2(obj1,obj2))

	// const mergedObj2 = { ...obj1, ...obj2,...arr };
	// console.log(mergedObj2);

	// const student = { name: '小明', age: 18, city: '北京' };
	// console.log(objectToArray(student))
	// console.log(objectToArray2(student))
	// console.log(objectToArray3(student))
})

handleBanner = (mlist) => {
	$("#list_banner").html('');
	if (mlist && mlist.length > 0) {
		let itemHtml = mlist.map((item, i) => {
			return `<div class="swiper-slide">
						<img src="${item}" class="goods_detail_banner_img"/>
					</div>`;
		});

		$("#list_banner").html(itemHtml);

		let swiperBanner = new Swiper('.goods_detail_banner', {
			initialSlide: 0,
			nextButton: '.swiper-button-next',
			prevButton: '.swiper-button-prev',
			pagination: '.swiper-pagination',
			paginationType: 'fraction',
			slidesPerView: 'auto',
			paginationClickable: true,
			spaceBetween: 30,
			noSwiping: false,
			centeredSlides: true,
			loop: true,
			autoplay: 2500,
			autoplayDisableOnInteraction: false
		});
	}
}
